package facilius.controller.actionmanager;

import facilius.controller.ActionManager;
import facilius.controller.action.aula.AulaCreateAction;
import facilius.controller.action.aula.AulaDeleteAction;
import facilius.controller.action.aula.AulaReadAction;
import facilius.controller.action.aula.AulaShowFormAction;
import facilius.controller.action.aula.AulaUpdateAction;
import org.mentawai.authorization.Permission;
import org.mentawai.core.ActionConfig;
import org.mentawai.core.ApplicationManager;
import org.mentawai.core.Forward;
import org.mentawai.core.Redirect;
import org.mentawai.filter.AuthorizationFilter;
import org.mentawai.filter.FileUploadFilter;

/**
 *
 * @author Graciano
 */
public class AulaActionManager implements ActionManager{

    public void loadActions(ApplicationManager appManager) {
      ActionConfig ac = null;

        ac = new ActionConfig("AulaRead",AulaReadAction.class);
        ac.addConsequence(appManager.SUCCESS, new Forward("jsp/aula/aulaList.page"));
        ac.addConsequence(appManager.ERROR, new Forward("jsp/erro.page"));
        ac.addFilter(new AuthorizationFilter(new Permission("aula")));
        appManager.addActionConfig(ac);

        ac = new ActionConfig("AulaShowForm",AulaShowFormAction.class);
        ac.addConsequence(appManager.SUCCESS, new Forward("jsp/aula/aulaForm.page"));
        ac.addConsequence(appManager.ERROR, new Forward("jsp/erro.page"));
        ac.addFilter(new AuthorizationFilter(new Permission("aula")));
        appManager.addActionConfig(ac);

        ac = new ActionConfig("AulaCreate", AulaCreateAction.class);
        ac.addConsequence(appManager.SUCCESS, new Redirect("AulaRead.mtw"));
        ac.addConsequence(appManager.ERROR, new Forward("jsp/erro.page"));
        ac.addFilter(new AuthorizationFilter(new Permission("aula")));
        appManager.addActionConfig(ac);

        ac = new ActionConfig("AulaDelete",AulaDeleteAction.class);
        ac.addConsequence(appManager.SUCCESS, new Redirect("AulaRead.mtw"));
        ac.addConsequence(appManager.ERROR, new Forward("jsp/erro.page"));
        ac.addFilter(new AuthorizationFilter(new Permission("aula")));
        appManager.addActionConfig(ac);

        ac = new ActionConfig("AulaUpdate",AulaUpdateAction.class);
        ac.addConsequence(appManager.SUCCESS, new Redirect("AulaRead.mtw"));
        ac.addConsequence(appManager.ERROR, new Forward("jsp/erro.page"));
        ac.addFilter(new AuthorizationFilter(new Permission("aula")));
        appManager.addActionConfig(ac);
    }

}
